<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网格布局</title>
    <style>
        .grid {
            margin: 5px auto;
            display: flex;
            height: 44px;
            line-height: 44px;
            text-align: center;
        }

        [class^='grid-'] {
            margin: 0 5px;
            background-color: skyblue;
        }

        .grid-21 {
            flex: 1;
        }
        .grid-31 {
            flex-grow: 1;
        }
        .h300 {
            height: 180px;
            text-align: start;
        }
        .lh20 {
            line-height: 20px;
        }
    </style>
</head>
<body>
    <div class="grid">
        <div class="grid-21">1/2</div>
        <div class="grid-21">1/2</div>
    </div>
    <div class="grid">
        <div class="grid-31">1/3</div>
        <div class="grid-31">1/3</div>
        <div class="grid-31">1/3</div>
    </div>
    <div class="grid">
        <div class="grid-21">1/4</div>
        <div class="grid-21">1/4</div>
        <div class="grid-21">1/4</div>
        <div class="grid-21">1/4</div>
    </div>
    <div class="grid h300">
        <div class="grid-21 lh20">洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。</div>
        <div class="grid-21 lh20">洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。洛神赋·曹植 芳草萋萋，白露未晞，所谓伊人在水之湄。</div>
    </div>
    <hr>
    <div class="grid">
        <div style="width: 50%;background-color: slateblue;">1/2</div>
        <div class="grid-21">auto</div>
        <div class="grid-21">auto</div>
    </div>
    <div class="grid">
        <div class="grid-21">auto</div>
        <div style="width: 66.67%;background-color: slateblue;">2/3</div>
    </div>
    <div class="grid">
        <div style="width: 25%;background-color: slateblue;">1/4</div>
        <div class="grid-21">auto</div>
        <div style="width: 33.33%;background-color: slateblue;">1/3</div>
    </div>
</body>
</html>